import httpInstance from "./http"

// 管理员登录 /function_supplement/admin_login
export function admin_loginAPI({ username, password }) {
    return httpInstance({
        url: '/function_supplement/admin_login',
        method: 'post',
        params: {
            username,
            password
        }
    })
}


// 加载所有基础用户信息 /function_supplement/load_common_user_info
export function load_common_user_infoAPI() {
    return httpInstance({
        url: '/function_supplement/load_common_user_info',
        method: 'post',
    })
}

// id修改基础用户的账号状态 /function_supplement/change_account_status_by_id
export function change_account_status_by_idAPI({ userId, isUnable }) {
    return httpInstance({
        url: '/function_supplement/change_account_status_by_id',
        method: 'post',
        params: {
            userId,
            isUnable
        }
    })
}

// 加载所有歌手信息 /function_supplement/load_singer_user_info
export function load_singer_user_infoAPI() {
    return httpInstance({
        url: '/function_supplement/load_singer_user_info',
        method: 'post',
    })
}


// 用户编辑个人资料 /user/edit_user_info
export const edit_user_infoAPI = ({
    address = "",
    avatarId = 0,
    backgroundImage = "0",
    fans = "周杰伦",
    gender = 0,
    metaUniverseId = 0,
    nickName = "昵称",
    password = "123456",
    profile = "地址",
    signature = "个性签名",
    userId = 4827, // 不可修改
    userName = "账户名" //不可修改
}) => {
    return httpInstance({
        url: '/user/edit_user_info',
        method: 'post',
        params: {
            address,
            avatarId,
            backgroundImage,
            fans,
            gender,
            metaUniverseId,
            nickName,
            password,
            profile,
            signature,
            userId, // 不可修改
            userName //不可修改
        }
    })
}

// 统计歌曲评论数 /function_supplement/count_song_comments
export function count_song_commentsAPI() {
    return httpInstance({
        url: '/function_supplement/count_song_comments',
        method: 'post',
    })
}
// 统计歌曲收藏数 /function_supplement/count_song_favorite
export function count_song_favoriteAPI() {
    return httpInstance({
        url: '/function_supplement/count_song_favorite',
        method: 'post',
    })
}
// 统计歌曲播放数 /function_supplement/count_song_play
export function count_song_playAPI() {
    return httpInstance({
        url: '/function_supplement/count_song_play',
        method: 'post',
    })
}

// 上传头像 http://localhost:9999/upload_profiles
export function upload_profilesAPI (data = new FormData()) {
    return httpInstance({
        url: 'http://localhost:9999/upload_profiles',
        method: 'post',
        data
    })
}

// 上传背景图片 http://localhost:9999/upload_background_image
export function upload_background_imageAPI (data = new FormData()) {
    return httpInstance({
        url: 'http://localhost:9999/upload_background_image',
        method: 'post',
        data
    })
}